# -*- coding: utf-8 -*-
# @author: wch
# @file: threshod.py
# @time: 2023/3/9 11:16

# 二值化
import cv2
import numpy as np

img = cv2.imread(r"E:\code\opencv\media\2.jpg")
img1 = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

ret, dst = cv2.threshold(img1, 150, 190, cv2.THRESH_BINARY)  # 二值化有两个返回值

cv2.imshow("img", img)
cv2.imshow("gray", img1)
cv2.imshow("dst", dst)

cv2.waitKey(0)
